use "C:\dataset-Peace_at_home_conflict_abroad.dta"
***MAIN TEXT

**rescaling of ideology variable 
gen gov_ideology_rescaled=(cabinet_ideology + 50) /10

** Descriptive Tables
*Table 1
sum AI gov_ideology_rescaled cabinet_dicothomous type share coalition mil_exp Distancein_kkm Exante_Veto_power extension_vote if type!=.
*Table 2
tab cabinet_dic type if Exante_Veto_power==1 & Distancein_kkm!=. & AI!=., row
*Table 3
tab cabinet_dic type if Exante_Veto_power==0 & Distancein_kkm!=. & AI!=., row
*Table 4
mean AI if Distancein_kkm!=., over(cabinet_dic type)

**regression models  
*model 1
reg AI c.gov_ideology_rescaled i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
*margins upper figure 1
set scheme s1mono
margins, at (gov_ideology_rescaled=(0 (1) 10))
marginsplot,  xscale(range (0 (1) 10)) xtitle ("Cabinet Ideology") title("") ///
addplot(histogram gov_ideology, width(1) yaxis(2) yscale(alt) fcolor(%25) lc(black%50) ) legend(off)
graph save Graph graph_ideology_cont.gph
*margins figure 2
set scheme s1mono
margins, at(type=(0 1))
marginsplot, xlabel(0 "Strategic" .2 " " .4 " " .6 " " .8 " " 1 "Inclusive", notick) xtitle ("Type of Mission") title("") /// 
addplot(histogram type, yaxis(2) yscale(alt) fcolor(%25) lc(black%50)) legend(off)
*model 2
reg AI c.gov_ideology_rescaled##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
*model 3
reg AI i.cabinet_dicothomous i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
*margins lower figure 1
set scheme s1mono
margins, at(cabinet_dicothomous=(0 1))
marginsplot, xlabel(0 "Left-wing cabinet" .2 " " .4 " " .6 " " .8 " " 1 "Right-wing cabinet", notick) xtitle ("") title("") /// 
addplot(histogram cabinet_dicothomous, yaxis(2) yscale(alt) fcolor(%25) lc(black%50)) legend(off)
graph save Graph graph_ideology_dummy.gph
*model 4
reg AI i.cabinet_dicothomous##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
*figure 1 (combination)
graph combine "graph_ideology_cont.gph" "graph_ideology_dummy.gph", col(1)

***APPENDIX

*RB1 - Table A3 - Quadratic term included
reg AI c.gov_ideology_rescaled##c.gov_ideology_rescaled i.type i.coalition share mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB2 - Table A4 - share of no votes
reg share_no_votes_parl c.gov_ideology_rescaled i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg share_no_votes_parl c.gov_ideology_rescaled##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg share_no_votes_parl i.cabinet_dicothomous i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg share_no_votes_parl i.cabinet_dicothomous##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB3 - Table A5 - different measure of ideology
reg AI c.gov_left3 i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI c.gov_left3##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB4 - Table A6 - different measure of type of mission
reg AI c.gov_ideology_rescaled i.non_combat share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI c.gov_ideology_rescaled##i.non_combat share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous i.non_combat share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous##i.non_combat share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB5 - Table A7 - NATO mission
reg AI c.gov_ideology_rescaled i.NATO_mission share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI c.gov_ideology_rescaled##i.NATO_mission share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous i.NATO_mission share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous##i.NATO_mission share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB6 - Table A8 - minority government
gen min_gov=1 if share<=.5
replace min_gov=0 if share>.5
reg AI c.gov_ideology_rescaled i.type min_gov i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI c.gov_ideology_rescaled##i.type min_gov i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous i.type min_gov i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous##i.type min_gov i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB7 - Table A9 - country & year fixed effect
reg AI c.gov_ideology_rescaled i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm i.iso3n i.year
reg AI c.gov_ideology_rescaled##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm i.iso3n i.year
reg AI i.cabinet_dicothomous i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm i.iso3n i.year
reg AI i.cabinet_dicothomous##i.type share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm i.iso3n i.year

*RB8 - Table A10 - models with multiple vote
reg AI c.gov_ideology_rescaled share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)
reg AI i.cabinet_dicothomous share i.coalition mil_exp i.Exante_Veto_power i.extension_vote Distancein_kkm, vce(cluster country)

*RB9 - Table A11 - only ex ante veto power country
reg AI c.gov_ideology_rescaled i.type share i.coalition mil_exp i.extension_vote Distancein_kkm if Exante_Veto_power==1, vce(cluster country)
reg AI c.gov_ideology_rescaled##i.type share i.coalition mil_exp i.extension_vote Distancein_kkm if Exante_Veto_power==1, vce(cluster country)
reg AI i.cabinet_dicothomous i.type share i.coalition mil_exp i.extension_vote Distancein_kkm if Exante_Veto_power==1, vce(cluster country)
reg AI i.cabinet_dicothomous##i.type share i.coalition mil_exp i.extension_vote Distancein_kkm if Exante_Veto_power==1, vce(cluster country)








